﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLKhachSan.DTO;
using System.Data;
using System.Data.SqlClient;

namespace QLKhachSan.DAO
{
    public class DAO_CTPhieuDen
    {
        public static void themCTPhieuDen(DTO_CTPhieuDen p)
        {
            string[] name = new string[3] { "@MaPhieuDen","@NgayTra","@TenPhong"};
            object[] ob = new object[3] { p.MaPhieuDen,p.NgayTra,p.TenPhong };
            clsKetNoi.ThucThiLenhCoTS("pr_ThemCTPhieuDen", name, ob, 3);
        }
        public static DataTable hienthiDanhSachCTPhieuDen()
        {
            return clsKetNoi.Load("pr_HienThiCTPhieuDen");
        }
       
        public static void xoaCTPhieuDen(DTO_CTPhieuDen p)
        {
            string[] name = new string[1] { "@MaCTPhieuDen" };
            object[] ob = new object[1] { p.MaCTPhieuDen };
            clsKetNoi.ThucThiLenhCoTS("pr_XoaCTPhieuDen", name, ob, 1);
        }
        public static DataTable hienthiDanhSachCTPhieuDatPhongTheoMaPhieuDen(DTO_CTPhieuDen p)
        {
            string[] name = new string[1] { "@MaPhieuDen" };
            object[] ob = new object[1] { p.MaPhieuDen };
            return clsKetNoi.LoadCoTS("pr_HienThiDanhSachCTPhieuDenTheoMaPhieuDen", name, ob, 1);
        }

        public static DataTable HienThiDanhSachCTPhieuDenDeThanhToan(DTO_CTPhieuDen p)
        {
            string[] name = new string[1] { "@MaPhieuDen" };
            object[] ob = new object[1] { p.MaPhieuDen };
            return clsKetNoi.LoadCoTS("pr_HienThiDanhSachCTPhieuDenDeThanhToan", name, ob, 1);
        }
        public static DataTable hienthiDanhSachCTPhieuDenSapHetHan()
        {
            string[] name = new string[3] { "@Ngay", "@Thang", "@Nam" };

            object[] ob = new object[3] { DateTime.Now.AddDays(1).Day, DateTime.Now.AddDays(1).Month, DateTime.Now.AddDays(1).Year };

            return clsKetNoi.LoadCoTS("pr_HienThiCTPhieuDenSapHetHan", name, ob, 3);
        }
       
        public static DataTable hienthiDanhSachCTPhieuDenThongKe()
        {
            return clsKetNoi.Load("pr_HienThiCTPhieuDenThongKe");
        }
     
        public static DataTable hienthiDanhSachCTPhieuDenQuaHan()
        {
            return clsKetNoi.Load("pr_HienThiCTPhieuDenXuLyQuaHan");
        }

        public static void SuaCTPhieuDenTheoNgayTra(DTO_CTPhieuDen p)
        {
            string[] name = new string[3] { "@MaPhieuDen", "@NgayTra", "@TenPhong" };
            object[] ob = new object[3] { p.MaPhieuDen, p.NgayTra, p.TenPhong };
           
            clsKetNoi.ThucThiLenhCoTS("pr_SuaCTPhieuDenTheoNgayTra", name, ob, 3);
        }
        
       public static DataTable HienThiDanhSachCTPhieuDenTheoTenPhong(string tenp)
        {
            string[] name = new string[1] { "@TenPhong" };
            object[] ob = new object[1] {  tenp};
            return clsKetNoi.LoadCoTS("pr_HienTHiCTPhieuDenTheoTenPhong", name, ob, 1);
        }
    }
}
